home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / ov-str-mat.h < prev    next >
C/C++ Source or Header  |  1996-11-21  |  3KB  |  138 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_char_matrix_str_h)
  24. #define octave_char_matrix_str_h 1
  25.  
  26. #if defined (__GNUG__)
  27. #pragma interface
  28. #endif
  29.  
  30. #include <cstdlib>
  31.  
  32. #include <string>
  33.  
  34. class ostream;
  35.  
  36. #include "mx-base.h"
  37. #include "str-vec.h"
  38.  
  39. #include "error.h"
  40. #include "ov-ch-mat.h"
  41. #include "ov-typeinfo.h"
  42.  
  43. class Octave_map;
  44. class octave_value_list;
  45.  
  46. class tree_walker;
  47.  
  48. // Character matrix values with special properties for use as
  49. // strings.
  50.  
  51. class
  52. octave_char_matrix_str : public octave_char_matrix
  53. {
  54. public:
  55.  
  56.   octave_char_matrix_str (void)
  57.     : octave_char_matrix () { }
  58.  
  59.   octave_char_matrix_str (const charMatrix& chm)
  60.     : octave_char_matrix (chm) { }
  61.  
  62.   octave_char_matrix_str (const char *s)
  63.     : octave_char_matrix (s) { }
  64.  
  65.   octave_char_matrix_str (const string& s)
  66.     : octave_char_matrix (s) { }
  67.  
  68.   octave_char_matrix_str (const string_vector& s)
  69.     : octave_char_matrix (s) { }
  70.  
  71.   octave_char_matrix_str (const octave_char_matrix& chm)
  72.     : octave_char_matrix (chm) { }
  73.  
  74.   octave_char_matrix_str (const octave_char_matrix_str& chms)
  75.     : octave_char_matrix (chms) { }
  76.  
  77.   ~octave_char_matrix_str (void) { }
  78.  
  79.   octave_value *clone (void) { return new octave_char_matrix_str (*this); }
  80.  
  81.   type_conv_fcn numeric_conversion_function (void) const;
  82.  
  83.   octave_value index (const octave_value_list& idx) const;
  84.  
  85.   void assign (const octave_value_list& idx, const charMatrix& rhs);
  86.  
  87.   octave_value all (void) const;
  88.   octave_value any (void) const;
  89.  
  90.   bool is_string (void) const { return true; }
  91.  
  92.   bool is_real_type (void) const { return true; }
  93.  
  94.   bool valid_as_scalar_index (void) const;
  95.   bool valid_as_zero_index (void) const;
  96.  
  97.   bool is_true (void) const;
  98.  
  99.   Matrix matrix_value (bool = false) const;
  100.  
  101.   string_vector all_strings (void) const;
  102.  
  103.   string string_value (void) const;
  104.  
  105.   octave_value transpose (void) const
  106.     { return octave_value (matrix.transpose (), true); }
  107.  
  108.   octave_value hermitian (void) const
  109.     { return octave_value (matrix.transpose (), true); }
  110.  
  111.   void print (ostream& os, bool pr_as_read_syntax = false);
  112.  
  113.   int type_id (void) const { return t_id; }
  114.  
  115.   string type_name (void) const { return t_name; }
  116.  
  117.   static int static_type_id (void) { return t_id; }
  118.  
  119.   static void register_type (void)
  120.     { t_id = octave_value_typeinfo::register_type (t_name); }
  121.  
  122. private:
  123.  
  124.   // Type id of char_matrix_str objects, set by register_type().
  125.   static int t_id;
  126.  
  127.   // Type name of char_matrix_strXX objects, defined in ov-str-mat.cc.
  128.   static const string t_name;
  129. };
  130.  
  131. #endif
  132.  
  133. /*
  134. ;;; Local Variables: ***
  135. ;;; mode: C++ ***
  136. ;;; End: ***
  137. */
  138.